#pragma once
#include "UltimateInputSubsystem.h"
#include "android/input.h"
#include <android/sensor.h>
#include <android_native_app_glue.h>
#include <android/log.h>



class UltimateAndroidInputSubsystem : public UltimateInputSubsystem{

	UltimateInputSubsystem::UltimateInputStruct inputStruct;
	float x0,y0,x1,y1;
	float ax,ay,az;
	int64_t lastPointerUpEventTime;


	ASensorManager* sensorManager;
	const ASensor* accelerometerSensor;
	ASensorEventQueue* sensorEventQueue;

	bool accelometerInited;
	bool pointerDown;



public:
	UltimateAndroidInputSubsystem(struct android_app* state);
	virtual ~UltimateAndroidInputSubsystem();

	virtual void registerSensors();
	virtual void unRegisterSernsors();
	virtual void handleSensors();

	virtual void updateInput(AInputEvent* event);
	virtual void clearInput();


	virtual UltimateInputSubsystem::UltimateInputStruct * handleInput();

};


